//package com.kjj.gift.feign.interceptor;
//
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
////Fiegn拦截器
//public class DefaultOAuth2FeignRequestInterceptor implements RequestInterceptor {
//
//    //请求头中的token
//    private final String AUTHORIZATION_HEADER = "Authorization";
//    @Override
//    public void apply(RequestTemplate requestTemplate) {
//        //获取请求对象
//        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)
//                RequestContextHolder.getRequestAttributes();
//        HttpServletRequest request = servletRequestAttributes.getRequest();
//
//        //从请求头中获取token
//        //2.从请求头获取到令牌
//        String authorization = request.getHeader(AUTHORIZATION_HEADER);
//
//        //3.把令牌添加到Fiegn的请求头  通过远程调用服务来使用token
//        requestTemplate.header(AUTHORIZATION_HEADER,authorization);
//
//    }
//}
